package cn.yuanqiao.archive.liyong.domain;

import cn.yuanqiao.common.annotation.Excel;
import cn.yuanqiao.common.utils.StringUtils;
import cn.yuanqiao.common.core.domain.BaseEntity;
import cn.yuanqiao.common.utils.SecurityUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 我的订阅对象 YQDY_DA
 * 
 * @author sy
 * @date 2023-08-10
 */
public class YqdyDa extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    private final String BIGTABLENAME = "_YQDY_DA";

    public YqdyDa() {
        String userCode = SecurityUtils.getTenantCode();
        if(StringUtils.isEmpty(userCode)){
//            throw new ServiceException("TenantCode is null");
            this.tableName = "YQDY_DA";
        }else {
            this.tableName = userCode.toUpperCase()+BIGTABLENAME;
//            this.tableName = "YQDY_DA";
        }
    }

    private String tableName;

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    /** 订阅ID */
    @Excel(name = "订阅ID")
    private Long dyId;

    /** 档案ID */
    @Excel(name = "档案ID")
    private Long daId;

    /** 添加时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "添加时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date tjsj;

    /** 分表表名 */
    @Excel(name = "分表表名")
    private String subTableName;

    /** 档案类型
     0：组件
     1：组卷
     3：项目*/
    @Excel(name = "档案类型 0：组件 1：组卷 3：项目")
    private Integer type;

    /** 消息状态
     0：未读
     1：已读 */
    @Excel(name = "消息状态 0：未读 1：已读")
    private Integer state;

    public void setDyId(Long dyId) 
    {
        this.dyId = dyId;
    }

    public Long getDyId() 
    {
        return dyId;
    }
    public void setDaId(Long daId) 
    {
        this.daId = daId;
    }

    public Long getDaId() 
    {
        return daId;
    }
    public void setTjsj(Date tjsj) 
    {
        this.tjsj = tjsj;
    }

    public Date getTjsj() 
    {
        return tjsj;
    }
    public void setSubTableName(String subTableName) 
    {
        this.subTableName = subTableName;
    }

    public String getSubTableName() 
    {
        return subTableName;
    }
    public void setState(Integer state) 
    {
        this.state = state;
    }

    public Integer getState() 
    {
        return state;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("dyId", getDyId())
            .append("daId", getDaId())
            .append("tjsj", getTjsj())
            .append("subTableName", getSubTableName())
            .append("state", getState())
            .append("type",getType())
            .toString();
    }
}
